package javafoundation;

import com.company.LinkedBinaryTree;
import java.util.Scanner;

public class DesionTree {
    private LinkedBinaryTree<String> tree;


    public DesionTree(){


        String e1 = "你喜欢听歌吗？";


        String e2 = "那你平时有听说过林俊杰吗？";


        String e3 = "那你听过林俊杰的歌吗？";


        String e4 = "希望你能听一下他的歌，很好听！！";


        String e5 = "那你听过他的新歌《wonderland》吗？";


        String e6 = "那你知道林俊杰的新歌《wonderland》吗？";


        String e7 = "你听过林俊杰的《wonderland》吗？";


        String e8 = "希望你能去听他的新歌，很棒！";


        String e9 = "《wonderland》拍了MV，快去看吧！";


        String e10 = "希望你能去听他的新歌，很棒！";


        String e11 = "那你知道这首歌拍了MV吗？";


        String e12 = "希望你能去听他的新歌，很棒！";


        String e13 = "《wonderland》拍了MV，快去看吧！";


        String e14 = "《wonderland》拍了MV，快去看吧！";


        String e15 = "《wonderland》拍了MV，快去看吧！";


        LinkedBinaryTree<String>n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15;


        n15 = new LinkedBinaryTree<String>(e15);


        n14 = new LinkedBinaryTree<String>(e14);


        n11 = new LinkedBinaryTree<String>(e11,n14,n15);


        n12 = new LinkedBinaryTree<String>(e12);


        n13 = new LinkedBinaryTree<String>(e13);


        n7 = new LinkedBinaryTree<String>(e7,n12,n13);


        n8 = new LinkedBinaryTree<String>(e8);

        n9 = new LinkedBinaryTree<String>(e9);


        n5 = new LinkedBinaryTree<String>(e5,n8,n9);


        n10 = new LinkedBinaryTree<String>(e10);


        n6 = new LinkedBinaryTree<String>(e6,n10,n11);


        n4 = new LinkedBinaryTree<String>(e4);


        n2 = new LinkedBinaryTree<String>(e2,n4,n5);


        n3 = new LinkedBinaryTree<String>(e3,n6,n7);

        tree = new LinkedBinaryTree<String>(e1,n2,n3);


    }


    public void diagose() throws Exception {


        Scanner scan = new Scanner(System.in);


        LinkedBinaryTree<String>current = tree;
        while (current.size() > 1)
        {
            System.out.println (current.getRootElement());
            if (scan.nextLine().equalsIgnoreCase("N"))
                current = current.getLeft();
            else
                current = current.getRight();


        }

        System.out.println (current.getRootElement());


    }

}
